library FirstAidSkills initializer init 


	private function Trig_FirstAidSkills_Conditions takes nothing returns boolean
		return GetLearnedSkill()=='A04F'
	endfunction

	private function Trig_FirstAidSkills_Actions takes nothing returns nothing
		local integer i = 2
		local player p = GetTriggerPlayer()
		call SetPlayerTechResearched( p, 'R001', GetPlayerTechCount(p,'R001',true) + 1 )
		if GetPlayerTechCount(p,'R001',true)==5 then
			call DisplayTextToForce( GetForceOfPlayer(p), "|cffcd950cALICE|r : You have developed a high resistance to ailments." )
			call UnitAddAbility(udg_Hero[GetConvertedPlayerId(p)] , 'A05K' )
			loop
				exitwhen i > 7
				set udg_AilmentChance[((GetConvertedPlayerId(p)-1)*7)+i] = 150
				set i = i + 1
			endloop
			if udg_Mode!=3 then
				call DestroyTrigger(GetTriggeringTrigger())
			endif
		endif
	endfunction

	private function init takes nothing returns nothing
		local trigger t
		set t = CreateTrigger(  )
		call TriggerRegisterAnyUnitEventBJ( t, EVENT_PLAYER_HERO_SKILL )
		call TriggerAddCondition( t, Condition( function Trig_FirstAidSkills_Conditions ) )
		call TriggerAddAction( t, function Trig_FirstAidSkills_Actions )
	endfunction

endlibrary